<?php
namespace ZhuJiu\Controller;
use Think\Controller;
use LaneWeChat\Core\Menu;
/**
 * Created by PhpStorm.
 * User: medivh
 * Date: 15-5-26
 * Time: 下午4:56
 */
Class WxController extends Controller{
    public function setMenu(){
        if(IS_AJAX){

        }else{
//            require C('PUBLIC').'/Public/LaneWeChat/lanewechat.php';
//            $menu = Menu::getMenu();
//            $i=0;
//            foreach($menu['menu']['button'] as $key => $val){
//                $parentsMenu[] = array('id'=>$i++,'pid'=>'','name'=>$val['name'],'type'=>'','code'=>'');
//            }
//            foreach($menu['menu']['button'] as $key => $val){
//                $sonsMenu[] = $val['sub_button'];
//            };
//            foreach($sonsMenu as $key => $val){
//                foreach($val as $k => $v){
//                    $son = $v;
//                }
//            }
//            $this->parent = $parentsMenu;
//            $this->son = $son;
//            $this->cookie = cookie('menu');
            require C('PUBLIC').'/Public/data/MenuWeixin.class.php';
            $Menu = new \data\Menu\Menu();
            $this->menuList = $Menu->getMenu(C('WECHAT_APPID'),C('WECHAT_APPSECRET'));
            $this->display();
        }
    }
}